#ifndef NS_16550A_H
#define NS_16550A_H

#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)

#define	UART_BASE_ADDR		0xfeb50000
// #define	UART_RBR_OFFSET		0x0000
// #define	UART_THR_OFFSET		0x0000
// #define	UART_LSR_OFFSET		0x0005
// #define	UART_LSR_THRE		0x20

#define UART_RBR_OFFSET			0
#define UART_THR_OFFSET			0
#define UART_DLL_OFFSET			0
#define UART_IER_OFFSET			1
#define UART_DLM_OFFSET			1
#define UART_FCR_OFFSET			2
#define UART_IIR_OFFSET			2
#define UART_LCR_OFFSET			3
#define UART_MCR_OFFSET			4
#define UART_LSR_OFFSET			5
#define UART_MSR_OFFSET			6
#define UART_SCR_OFFSET			7
#define UART_MDR1_OFFSET		8

#define UART_LSR_FIFOE			0x80
#define UART_LSR_TEMT			0x40
#define UART_LSR_THRE			0x20
#define UART_LSR_BI			0x10
#define UART_LSR_FE			0x08
#define UART_LSR_PE			0x04
#define UART_LSR_OE			0x02
#define UART_LSR_DR			0x01
#define UART_LSR_BRK_ERROR_BITS		0x1E

#define UART_IIR_MSI			0x00
#define UART_IIR_NOINT			0x01
#define UART_IIR_TYPE			0x1e
#define UART_IIR_THRI			0x02
#define UART_IIR_RDI			0x04
#define UART_IIR_RLSI			0x06
#define UART_IIR_RTO			0x0c
#define UART_IIR_BUSY			0x07

#define UART_IER_MSI			0x08
#define UART_IER_RLSI			0x04
#define UART_IER_THRI			0x02
#define UART_IER_RDI			0x01

#endif